package com.example.safeassistan.train.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;
import com.example.safeassistan.train.model.OptionModel;

import java.util.List;


public class TestOptionAdapter extends BaseQuickAdapter<OptionModel, BaseViewHolder> {

    public TestOptionAdapter(List<OptionModel> data) {
        super(R.layout.item_test_option, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OptionModel item) {
        ImageView ivOption=helper.getView(R.id.ivOption);
        helper.setText(R.id.tvOptionText,item.getOptionStr());
        switch (helper.getPosition()){
            case 0:
                if(item.isSelected()){
                    Glide.with(mContext).load(R.mipmap.icon_option_a_gray).into(ivOption);
                }else {
                    Glide.with(mContext).load(R.mipmap.icon_option_a_black).into(ivOption);
                }
                break;
            case 1:
                if(item.isSelected()){
                    Glide.with(mContext).load(R.mipmap.icon_option_b_gray).into(ivOption);
                }else {
                    Glide.with(mContext).load(R.mipmap.icon_option_b_black).into(ivOption);
                }
                break;
            case 2:
                if(item.isSelected()){
                    Glide.with(mContext).load(R.mipmap.icon_option_c_gray).into(ivOption);
                }else {
                    Glide.with(mContext).load(R.mipmap.icon_option_c_black).into(ivOption);
                }
                break;
            case 3:
                if(item.isSelected()){
                    Glide.with(mContext).load(R.mipmap.icon_option_d_gray).into(ivOption);
                }else {
                    Glide.with(mContext).load(R.mipmap.icon_option_d_black).into(ivOption);
                }
                break;
        }
    }
}
